﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace eLoan.Models
{
    [Table("LoanJournal")]
    public class LoanJournal : LoanJournalFields
    { }

    public class LoanJournalFields
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        [Display(Name = "ID")]
        public int ID { get; set; }

        [Display(Name = "Document No")]
        public string DocumentNo { get; set; }

        [Display(Name = "Remarks")]
        public string Remarks { get; set; }

        [Display(Name = "Journal Date")]
        public DateTime JournalDate { get; set; }

        [Display(Name = "Encoded By")]
        public string EncodedBy { get; set; }
    }

    [Table("LoanPenalty")]
    public class LoanPenalty : LoanPenaltyFields
    { }

    public class LoanPenaltyQueryModel : LoanPenaltyFields
    {
        [Display(Name = "Maturity Date")]
        public DateTime MaturityDate { get; set; }

        [Display(Name = "Borrower ID")]
        public int BorrowerID { get; set; }

        [Display(Name = "Borrower")]
        public string BorrowerName { get; set; }

        [Display(Name = "BorrowerAddress")]
        public string BorrowerAddress { get; set; }

        [Display(Name = "Loan Amount")]
        public decimal LoanAmount { get; set; }

        [Display(Name = "Loan Interest %")]
        public decimal LoanInterest { get; set; }

        [Display(Name = "Receivable")]
        public decimal Receivable { get; set; }

        [Display(Name = "Total Payment")]
        public decimal TotalPayment { get; set; }

        [Display(Name = "Last Payment Date")]
        public DateTime? LastPaymentDate { get; set; }

        [Display(Name = "Due to Date")]
        public decimal DueToDate { get; set; }

        [Display(Name = "Short / Over")]
        public decimal ShortOver { get; set; }

        [Display(Name = "Outstanding Balance")]
        public decimal OutstandingBalance { get; set; }

        [Display(Name = "Total Penalty")]
        public decimal TotalPenalty { get; set; }

        [Display(Name = "Total Additional Interest")]
        public decimal TotalAdditionalInterest { get; set; }

        [Display(Name = "Total Paid Penalty")]
        public decimal TotalPaidPenalty { get; set; }

        [Display(Name = "Last Penalty Date")]
        public DateTime? LastPenaltyDate { get; set; }

        [Display(Name = "Sort")]
        public int Sort { get; set; }
    }

    public class LoanPenaltyHistoryItem : LoanPenaltyFields
    {
        [Display(Name = "Borrower")]
        public string BorrowerName { get; set; }

        [Display(Name = "Loan Date")]
        public DateTime DocumentDate { get; set; }
    }

    public class LoanPenaltyPaymentHistoryItem
    {
        [Display(Name = "Borrower")]
        public string BorrowerName { get; set; }

        [Display(Name = "Document No")]
        public string DocumentNo { get; set; }

        [Display(Name = "Loan Date")]
        public DateTime DocumentDate { get; set; }

        [Display(Name = "Paid Penalty Amount")]
        public decimal PaidPenaltyAmount { get; set; }

        [Display(Name = "Payment Date")]
        public DateTime? PaymentDate { get; set; }
    }

    public class LoanPenaltyFields
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        [Display(Name = "ID")]
        public int ID { get; set; }

        [Display(Name = "Document No")]
        public string DocumentNo { get; set; }

        [Display(Name = "Penalty")]
        public decimal Penalty { get; set; }

        [Display(Name = "Additional Interest")]
        public decimal AdditionalInterest { get; set; }

        [Display(Name = "Due Date")]
        public DateTime DueDate { get; set; }

        [Display(Name = "Penalty Date")]
        public DateTime PenaltyDate { get; set; }

        [Display(Name = "Remarks")]
        public string Remarks { get; set; }

        [Display(Name = "Encoded By")]
        public string EncodedBy { get; set; }
    }
}